{include file="index/header" /}
<script>
    function showHint(str)
    {

        var xmlhttp;
        if (str.length==0)
        {
            document.getElementById("txtHint").innerHTML="请输入手机号";
            return;
        }

        if (str.length!=11)
        {
            document.getElementById("txtHint").innerHTML="手机号格式有误";
            return;
        }

        // var phone = str.length;
        //   if(!(/^1[34578]\d{9}$/.test(phone))){
        //       document.getElementById("txtHint").innerHTML="手机号格式有误";
        //       return false;
        //   }
        if (window.XMLHttpRequest)
        {
            // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
            xmlhttp=new XMLHttpRequest();
        }
        else
        {
            // IE6, IE5 浏览器执行代码
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
                document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","{$Think.server.script_name}/index/index/sms/phone/"+str,true);
        xmlhttp.send();
        showtime(60);
    }
</script>

<script type="text/javascript">

    function showtime(t){
        document.myform.code.disabled=true;
        for(i=1;i<=t;i++) {
            window.setTimeout("update_p(" + i + ","+t+")", i * 1000);
        }

    }

    function update_p(num,t) {
        if(num == t) {
            document.myform.code.value =" 重新发送 ";
            document.myform.code.disabled=false;
        }
        else {
            printnr = t-num;
            document.myform.code.value = " (" + printnr +")秒后重新发送";
        }
    }


</script>





<div class="panel panel-default">
  <div class="panel-heading">短信快速登录/注册</div>
  <div class="panel-body">

    {if condition="$warning"}
    <div class="alert alert-warning alert-dismissible" role="alert">
      <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <strong>提示!</strong> {$warning}
    </div>
    {/if}

    <form  action="" method="post" name="myform">

      {if condition="$invite_phone"}
      <div class="form-group " >
        <input class="form-control" type="text" placeholder="邀请人：{$invite_phone|substr=0,3}****{$invite_phone|substr=7,4}" readonly>
      </div>
      {/if}
      <div class="form-group " >
        <!-- <label for="exampleInputName2">手机号:</label> -->
        <input type="text" class="form-control" id="tel" name="phone" value="" placeholder="请输入手机号" maxlength="100" >
      </div>

      <div class="form-group form-inline" >
        <input type="text" class="form-control" id="yan" name="rand" value="" placeholder="请输入获得的验证码" maxlength="100"  style="    margin-bottom:  15px;">


        <input class="form-control" id="cl" type="button" onclick="showHint(document.getElementById('tel').value)"  style="    margin-bottom:  15px;" name="code" value="获取验证码" />

      </div>
      {if condition="$Request.param.pass"}
      <div class="form-group " >
        <!-- <label for="exampleInputName2">密码:</label> -->
        <input type="text" class="form-control" id="password" name="password" value="" placeholder="请输入您的新密码" maxlength="100" >
      </div>
      {/if}



      <p><span id="txtHint"></span></p>


      <button type="submit" id="btn" class="btn btn-primary"  >提交登录</button>

    </form>

  </div>
</div>

<p style="margin: 500px"></p>

{include file="index/footer" /}